/*
 * SrcAdmissionControl.cc
 *
 *  Created on: 2011-04-10
 *      Author: Jagger
 */

#include <vector>
#include "SrcAdmissionControl.h"

Define_Module(SrcAdmissionControl)

void SrcAdmissionControl::initialize()
{
	AbstractAdmissionControl::initialize();

	// Parsuj string na tablice identyfikatorow
	const char* ids = par("bannedIds");
	std::vector<int> vIds = cStringTokenizer(ids).asIntVector();

	for(uint32_t i = 0; i < vIds.size(); i++)
		bannedIds.insert(vIds[i]);
}

bool SrcAdmissionControl::acceptPacket(NetPacket* packet)
{
	return bannedIds.find(packet->getSrc()) == bannedIds.end();
}
